<?php
use Migrations\AbstractMigration;

class POCOR5312 extends AbstractMigration
{
    /**
     * Change Method.
     *
     * More information on this method is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-change-method
     * @return void
     */
    public function up()
    {
        //backup
        $this->execute('CREATE TABLE `z_5312_security_functions` LIKE `security_functions`');
        $this->execute('INSERT INTO `z_5312_security_functions` SELECT * FROM `security_functions`');  
            
        // security_functions
        $this->execute('UPDATE security_functions SET `order` = `order` + 1 WHERE `order` > 419');

        //insert 
        $record = [
            [
                'name' => 'Overview', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'General', 'parent_id' => -1,'_view' => 'Profiles.index|Profiles.view', '_edit' => 'Profiles.edit', '_add' => 'Profiles.add', '_delete' => 'Profiles.remove', '_execute' => NULL, 'order' => 420, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ]
        ];

        $this->insert('security_functions', $record);
        
        $row = $this->fetchRow("SELECT `id` FROM `security_functions` WHERE `controller` = 'Profiles' AND
                `module` = 'Profile'");
        $parentId = $row['id'];

        $data = [
            [
                'name' => 'Accounts','controller' => 'Profiles', 'module' => 'Profile', 'category' => 'General', 'parent_id' => $parentId,
                '_view' => 'Accounts.view', '_edit' => 'Accounts.edit', '_add' => 'Accounts.add', '_delete' => 'Accounts.remove', '_execute' => NULL, 'order' => 421, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Demographic', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'General', 'parent_id' => $parentId, '_view' => 'Demographic.index|Demographic.view', '_edit' => 'Demographic.edit', '_add' => 'Demographic.add', '_delete' => 'Demographic.remove', '_execute' => NULL, 'order' => 422, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Identities', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'General', 'parent_id' => $parentId, '_view' => 'Identities.index|Identities.view', '_edit' => 'Identities.edit', '_add' => 'Identities.add', '_delete' => 'Identities.remove', '_execute' => NULL, 'order' => 423, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Nationalities',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'General',
                'parent_id' => $parentId,
                '_view' => 'Nationalities.index|Nationalities.view',
                '_edit' => 'Nationalities.edit',
                '_add' => 'Nationalities.add',
                '_delete' => 'Nationalities.remove',
                '_execute' => NULL,
                'order' => 424,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Contacts',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'General',
                'parent_id' => $parentId,
                '_view' => 'Contacts.index|Contacts.view',
                '_edit' => 'Contacts.edit',
                '_add' => 'Contacts.add',
                '_delete' => 'Contacts.remove',
                '_execute' => NULL,
                'order' => 425,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Languages',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'General',
                'parent_id' => $parentId,
                '_view' => 'Languages.index|Languages.view',
                '_edit' => 'Languages.edit',
                '_add' => 'Languages.add',
                '_delete' => 'Languages.remove',
                '_execute' => NULL,
                'order' => 426,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Attachments',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'General',
                'parent_id' => $parentId,
                '_view' => 'Attachments.index|Attachments.view',
                '_edit' => 'Attachments.edit',
                '_add' => 'Attachments.add',
                '_delete' => 'Attachments.remove',
                '_execute' => NULL,
                'order' => 427,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Comments',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'General',
                'parent_id' => $parentId,
                '_view' => 'ProfileComments.index|ProfileComments.view',
                '_edit' => 'ProfileComments.edit',
                '_add' => 'ProfileComments.add',
                '_delete' => 'ProfileComments.remove',
                '_execute' => NULL,
                'order' => 428,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'History',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'General',
                'parent_id' => $parentId,
                '_view' => 'History.index|History.view',
                '_edit' => 'History.edit',
                '_add' => 'History.add',
                '_delete' => 'History.remove',
                '_execute' => NULL,
                'order' => 429,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Overview',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'Healths.index|Healths.view',
                '_edit' => 'Healths.edit',
                '_add' => 'Healths.add',
                '_delete' => 'Healths.remove',
                '_execute' => NULL,
                'order' => 430,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Allergies',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthAllergies.index|HealthAllergies.view',
                '_edit' => 'HealthAllergies.edit',
                '_add' => 'HealthAllergies.add',
                '_delete' => 'HealthAllergies.remove',
                '_execute' => NULL,
                'order' => 431,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Consultations',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthConsultations.index|HealthConsultations.view',
                '_edit' => 'HealthConsultations.edit',
                '_add' => 'HealthConsultations.add',
                '_delete' => 'HealthConsultations.remove',
                '_execute' => NULL,
                'order' => 432,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Families',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthFamilies.index|HealthFamilies.view',
                '_edit' => 'HealthFamilies.edit',
                '_add' => 'HealthFamilies.add',
                '_delete' => 'HealthFamilies.remove',
                '_execute' => NULL,
                'order' => 433,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Histories',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthHistories.index|HealthHistories.view',
                '_edit' => 'HealthHistories.edit',
                '_add' => 'HealthHistories.add',
                '_delete' => 'HealthHistories.remove',
                '_execute' => NULL,
                'order' => 434,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Vaccinations',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthImmunizations.index|HealthImmunizations.view',
                '_edit' => 'HealthImmunizations.edit',
                '_add' => 'HealthImmunizations.add',
                '_delete' => 'HealthImmunizations.remove',
                '_execute' => NULL,
                'order' => 435,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Medications',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthMedications.index|HealthMedications.view',
                '_edit' => 'HealthMedications.edit',
                '_add' => 'HealthMedications.add',
                '_delete' => 'HealthMedications.remove',
                '_execute' => NULL,
                'order' => 436,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Tests',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'HealthTests.index|HealthTests.view',
                '_edit' => 'HealthTests.edit',
                '_add' => 'HealthTests.add',
                '_delete' => 'HealthTests.remove',
                '_execute' => NULL,
                'order' => 437,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Body Mass',
                'controller' => 'ProfileBodyMasses',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'index|view',
                '_edit' => 'edit',
                '_add' => 'add',
                '_delete' => 'remove',
                '_execute' => NULL,
                'order' => 438,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Insurances',
                'controller' => 'ProfileInsurances',
                'module' => 'Profile',
                'category' => 'Health',
                'parent_id' => $parentId,
                '_view' => 'index|view',
                '_edit' => 'edit',
                '_add' => 'add',
                '_delete' => 'remove',
                '_execute' => NULL,
                'order' => 439,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Employments',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Professional',
                'parent_id' => $parentId,
                '_view' => 'Employments.index|Employments.view',
                '_edit' => 'Employments.edit',
                '_add' => 'Employments.add',
                '_delete' => 'Employments.remove',
                '_execute' => NULL,
                'order' => 440,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Referrals',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Special Needs',
                'parent_id' => $parentId,
                '_view' => 'SpecialNeedsReferrals.index|SpecialNeedsReferrals.view',
                '_edit' => 'SpecialNeedsReferrals.edit',
                '_add' => 'SpecialNeedsReferrals.add',
                '_delete' => 'SpecialNeedsReferrals.remove',
                '_execute' => NULL,
                'order' => 441,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Assessments',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Special Needs',
                'parent_id' => $parentId,
                '_view' => 'SpecialNeedsAssessments.index|SpecialNeedsAssessments.view',
                '_edit' => 'SpecialNeedsAssessments.edit',
                '_add' => 'SpecialNeedsAssessments.add',
                '_delete' => 'SpecialNeedsAssessments.remove',
                '_execute' => NULL,
                'order' => 442,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Services',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Special Needs',
                'parent_id' => $parentId,
                '_view' => 'SpecialNeedsServices.index|SpecialNeedsServices.view',
                '_edit' => 'SpecialNeedsServices.edit',
                '_add' => 'SpecialNeedsServices.add',
                '_delete' => 'SpecialNeedsServices.remove',
                '_execute' => NULL,
                'order' => 443,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Devices',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Special Needs',
                'parent_id' => $parentId,
                '_view' => 'SpecialNeedsDevices.index|SpecialNeedsDevices.view',
                '_edit' => 'SpecialNeedsDevices.edit',
                '_add' => 'SpecialNeedsDevices.add',
                '_delete' => 'SpecialNeedsDevices.remove',
                '_execute' => NULL,
                'order' => 444,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Plans',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Special Needs',
                'parent_id' => $parentId,
                '_view' => 'SpecialNeedsPlans.index|SpecialNeedsPlans.view',
                '_edit' => 'SpecialNeedsPlans.edit',
                '_add' => 'SpecialNeedsPlans.add',
                '_delete' => 'SpecialNeedsPlans.remove',
                '_execute' => NULL,
                'order' => 445,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],
            [
                'name' => 'Scholarship',
                'controller' => 'Profiles',
                'module' => 'Profile',
                'category' => 'Scholarships',
                'parent_id' => $parentId,
                '_view' => 'ScholarshipApplications.index|ScholarshipApplications.view',
                '_edit' => 'ScholarshipApplications.edit',
                '_add' => 'ScholarshipsDirectory.index',
                '_delete' => NULL,
                '_execute' => NULL,
                'order' => 446,
                'visible' => 1,
                'description' => NULL,
                'modified_user_id' => NULL,
                'modified' => NULL,
                'created_user_id' => 1,
                'created' => date('Y-m-d H:i:s'),
            ],[
              'name' => 'Students', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Guardian', 'parent_id' => $parentId, '_view' => 'ProfileStudents.index|ProfileStudents.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 447, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
              'name' => 'Students', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Overview', 'parent_id' => $parentId, '_view' => 'ProfileStudentUser.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 448, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
              'name' => 'Programmes', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentProgrammes.index|StudentProgrammes.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 449, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Classes', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentClasses.index|StudentClasses.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 450, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Subjects', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentSubjects.index|StudentSubjects.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 451, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Absences', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentAbsences.index|StudentAbsences.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 452, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Behaviours', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentBehaviours.index|StudentBehaviours.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 453, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Outcomes', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentOutcomes.index', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 454, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Competencies', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentCompetencies.index', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 455, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Assessments', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentResults.index.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 456, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Examinations', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentExaminationResults.index', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 457, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Report Cards', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentReportCards.index|StudentReportCards.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 458, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Awards', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentProgrammes.index|StudentProgrammes.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 459, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Extracurriculars', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentProgrammes.index|StudentProgrammes.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 460, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Textbooks', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentProgrammes.index|StudentProgrammes.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 461, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Risks', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentRisks.index|StudentRisks.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 462, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Associations', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Academic', 'parent_id' => $parentId, '_view' => 'StudentAssociations.index|StudentAssociations.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 463, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Guardians', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Guardians', 'parent_id' => $parentId, '_view' => 'ProfileGuardians.index|ProfileGuardians.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 464, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Timetables', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Timetables', 'parent_id' => $parentId, '_view' => 'StudentScheduleTimetable.index|StudentScheduleTimetable.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 465, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Finance', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Students - Finance', 'parent_id' => $parentId, '_view' => 'StudentBankAccounts.index|StudentBankAccounts.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 466, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Statuses', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffEmploymentStatuses.index|StaffEmploymentStatuses.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 467, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Positions', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffPositions.index|StaffPositions.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 468, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Classes', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffClasses.index|StaffClasses.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 469, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Subjects', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffSubjects.index|StaffSubjects.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 470, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Leave', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffLeave.index|StaffLeave.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 471, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Attendances', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffAttendances.index|StaffAttendances.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 472, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Behaviours', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffBehaviours.index|StaffBehaviours.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 473, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Appraisals', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffAppraisals.index|StaffAppraisals.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 474, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Duties', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffDuties.index|StaffDuties.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 475, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Associations', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Career', 'parent_id' => $parentId, '_view' => 'StaffAssociations.index|StaffAssociations.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 476, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Bank Accounts', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Finance', 'parent_id' => $parentId, '_view' => 'StaffBankAccounts.index|StaffBankAccounts.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 477, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Salaries', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Finance', 'parent_id' => $parentId, '_view' => 'StaffSalaries.index|StaffSalaries.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 478, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Payslips', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Finance', 'parent_id' => $parentId, '_view' => 'StaffPayslips.index|StaffPayslips.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 479, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Training Needs', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Training', 'parent_id' => $parentId, '_view' => 'TrainingNeeds.index|TrainingNeeds.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 480, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Training Results', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Training', 'parent_id' => $parentId, '_view' => 'TrainingResults.index|TrainingResults.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 481, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Courses', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Training', 'parent_id' => $parentId, '_view' => 'Courses.index|Courses.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 482, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ],[
             'name' => 'Timetables', 'controller' => 'Profiles', 'module' => 'Profile', 'category' => 'Staff - Timetables', 'parent_id' => $parentId, '_view' => 'ScheduleTimetable.index|ScheduleTimetable.view', '_edit' => NULL, '_add' => NULL, '_delete' => NULL, '_execute' => NULL, 'order' => 483, 'visible' => 1, 'description' => NULL, 'modified_user_id' => NULL, 'modified' => NULL, 'created_user_id' => 1, 'created' => date('Y-m-d H:i:s'),
            ]
        ];

        $this->insert('security_functions', $data);
    }

    // rollback
    public function down()
    {
        $this->execute('RENAME TABLE `z_5312_security_functions` TO `security_functions`');
        $this->execute('UPDATE security_functions SET `order` = `order` - 1 WHERE `order` > 419');  
    }
}
